package com.cskaoyan.utils.wx;
import com.cskaoyan.bean.pojo.User;
import com.cskaoyan.enums.ResultEnum;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.util.ObjectUtils;

public class UserUtil {

    public static Integer getUserId(){
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipals ().getPrimaryPrincipal ();
        if(ObjectUtils.isEmpty(user)){
            return ResultEnum.USER_NOT_LOGIN.getCode();
        }
        return user.getId();

    }
}
